package com.duoketech.controller.weixin;

import com.duoketech.controller.BaseController;
import com.duoketech.model.product.Product;
import com.duoketech.service.web.product.ProductService;
import com.duoketech.service.weixin.product.WxProductService;
import com.jfinal.plugin.activerecord.Page;

public class WxProductController extends BaseController {

    public void ajaxProduct(){
        int pageNum = getParaToInt("pageNum",1);
        int pageSize = getParaToInt("pageSize",4);
        Page<Product> productPage = WxProductService.ME.queryProduct(pageNum,pageSize);
        renderObject(productPage);
    }

    public void shopDetail(){
        int id = getParaToInt("id",0);
        setAttr("id",id);
        Product product = ProductService.ME.queryProductBy(id);
        setAttr("product",product);
        render("shop-detail.html");
    }

    public void queryProductById(){
        int id = getParaToInt("id",0);
        Product product = ProductService.ME.queryProductBy(id);
        renderObject(product);
    }
}
